// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'
import { bxAnaalyse } from '@/core/icons'

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: 'menu.home' },
    redirect: '/overviewInformation/index',
    children: [
      // 概览信息
      {
        path: '/overviewInformation',
        name: 'dashboard',
        redirect: '/overviewInformation/index',
        component: RouteView,
        hideChildrenInMenu: true,
        meta: { title: 'menu.overviewInformation', keepAlive: true, icon: bxAnaalyse, permission: ['dashboard'] },
        children: [
          {
            path: '/overviewInformation/index',
            name: 'Workplace',
            component: () => import('@/views/overviewInformation/index'),
            meta: { title: 'menu.overviewInformation.index', hidden: true, keepAlive: true, permission: ['dashboard'] }
          }
        ]
      },
      // 木马样本监测任务列表
      {
        path: '/trojanList',
        name: 'trojanList',
        redirect: '/trojanList/index',
        component: RouteView,
        hideChildrenInMenu: true,
        meta: { title: 'menu.trojanList', keepAlive: true, icon: 'form', permission: ['form'] },
        children: [
          {
            path: '/trojanList/index',
            name: 'BaseForm',
            component: () => import('@/views/trojanList/index'),
            meta: { title: 'menu.trojanList.index', hidden: true, keepAlive: true, permission: ['form'] }
          }
          // {
          //   path: '/form/aaa',
          //   name: 'aaa',
          //   component: () => import('@/views/form/aaa'),
          //   meta: { title: 'menu.form.basic-form', hidden: true, keepAlive: true, permission: ['form'] }
          // }
        ]
      },
      // 新建木马样本监测任务
      {
        path: '/newTrojanTask',
        name: 'newTrojanTask',
        component: RouteView,
        redirect: '/newTrojanTask/index',
        meta: { title: 'menu.newTrojanTask', icon: 'table', permission: ['table'] },
        children: [
          {
            path: '/newTrojanTask/index',
            name: 'TableListWrapper',
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/newTrojanTask/index'),
            meta: { title: 'menu.newTrojanTask.index', keepAlive: true, permission: ['table'] }
          }
        ]
      },

      // 蜜罐管理
      {
        path: '/honeypotManagement',
        name: 'profile',
        component: RouteView,
        redirect: '/honeypotManagement/honeynet',
        meta: { title: 'menu.honeypotManagement', icon: 'profile', permission: ['profile'] },
        children: [
          {
            path: '/honeypotManagement/honeynet',
            name: 'ProfileBasic',
            component: () => import('@/views//honeypotManagement/honeynet'),
            meta: { title: 'menu.honeypotManagement.honeynet', permission: ['profile'] }
          },
          {
            path: '/honeypotManagement/honeypot',
            name: 'ProfileAdvanced',
            component: () => import('@/views/honeypotManagement/honeypot'),
            meta: { title: 'menu.honeypotManagement.honeypot', permission: ['profile'] }
          }
        ]
      },

      // 探针管理
      {
        path: '/probeManagement',
        name: 'result',
        component: RouteView,
        redirect: '/probeManagement/probeInformation',
        meta: { title: 'menu.probeManagement', icon: 'check-circle-o', permission: ['result'] },
        children: [
          {
            path: '/probeManagement/probeInformation',
            name: 'ResultSuccess',
            component: () => import(/* webpackChunkName: "result" */ '@/views//probeManagement/probeInformation'),
            meta: { title: 'menu.probeManagement.probeInformation', keepAlive: false, hiddenHeaderContent: true, permission: ['result'] }
          },
          {
            path: '/probeManagement/probeParticulars',
            name: 'ResultProbedetail',
            component: () => import(/* webpackChunkName: "result" */ '@/views/probeManagement/probeParticulars'),
            meta: { title: 'menu.probeManagement.probeParticulars', keepAlive: false, hiddenHeaderContent: true, permission: ['result'] }
          }
        ]
      }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
